package bbchess.util;

import java.awt.Image;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;

/*
 * A utility class to import and play sound effects
 */
public final class ImageLoader {

    private static Image iconImage;
    private static Image logoImage;
    private static Image deskImage;
    private static Image borderImage;
    private static Image boardImage;
    private static Image statusPanelImage;
    private static Image wPawnHighlightedImage;
    private static Image bPawnHighlightedImage;
    private static Image wPawnImage;
    private static Image bPawnImage;
    private static Image wRookImage;
    private static Image bRookImage;
    private static Image wKnightImage;
    private static Image bKnightImage;
    private static Image wBishopImage;
    private static Image bBishopImage;
    private static Image wKingImage;
    private static Image bKingImage;
    private static Image wQueenImage;
    private static Image bQueenImage;
    private static Image currentImage;
    private static Image highlightImage;
    private static Image threatenedImage;
    private static Image lastMoveImage;
    private static Image mouseHighlightImage;
    
    // load newgamedialog images
    private static Image titlePanelImage;
    private static Image pvcImage;
    private static Image pvpLocalImage;
    private static Image pvpInternetImage;

    /** Constructor set to private to prevent instantisation */
    private ImageLoader() {
    }

    public static void loadImages() {

        try {
            iconImage = ImageIO.read(new File("resource/icon/bbchesswindowicon.png"));
        } catch (IOException e) {
            System.out.println("Failed to load icon image.");
        }

        try {
            logoImage = ImageIO.read(new File("resource/icon/logo.png"));
        } catch (IOException e) {
            System.out.println("Failed to load icon image.");
        }

        try {
            deskImage = ImageIO.read(new File("resource/chessgraphics/desk/desk1.bmp"));
        } catch (IOException e) {
            System.out.println("Failed to load desk image.");
        }

        try {
            borderImage = ImageIO.read(new File("resource/chessgraphics/border/border1.bmp"));
        } catch (IOException e) {
            System.out.println("Failed to load border image.");
        }

        try {
            boardImage = ImageIO.read(new File("resource/chessgraphics/board/metal.bmp"));
        } catch (IOException e) {
            System.out.println("Failed to load board image.");
        }

        try {
            titlePanelImage = ImageIO.read(new File("resource/chessgraphics/newgamedialog/titlePanel.png"));
        } catch (Exception ex) {
            System.out.println("Error loading title panel image");
        }

        try {
            pvcImage = ImageIO.read(new File("resource/chessgraphics/newgamedialog/pvc.png"));
        } catch (Exception ex) {
            System.out.println("Error loading pvc image");
        }

        try {
            pvpLocalImage = ImageIO.read(new File("resource/chessgraphics/newgamedialog/pvplocal.png"));
        } catch (Exception ex) {
            System.out.println("Error loading pvp local image");
        }

        try {
            pvpInternetImage = ImageIO.read(new File("resource/chessgraphics/newgamedialog/pvpinternet.png"));
        } catch (Exception ex) {
            System.out.println("Error loading pvp internet image");
        }

        try {
            statusPanelImage = ImageIO.read(new File("resource/chessgraphics/statuspanel/statuspanel.bmp"));
        } catch (Exception ex) {
            System.out.println("Error loading status panel image");
        }

        try {
            wPawnHighlightedImage = ImageIO.read(new File("resource/chessgraphics/statuspanel/wpawnhighlighted.png"));
        } catch (Exception ex) {
            System.out.println("Error loading wpawn highlighted image");
        }

        try {
            bPawnHighlightedImage = ImageIO.read(new File("resource/chessgraphics/statuspanel/bpawnhighlighted.png"));
        } catch (Exception ex) {
            System.out.println("Error loading bpawn highlighted image");
        }

        try {
            wPawnImage = ImageIO.read(new File("resource/chessgraphics/pieces/classic/wpawn.png"));
        } catch (Exception ex) {
            System.out.println("Error loading wpawn image");
        }

        try {
            bPawnImage = ImageIO.read(new File("resource/chessgraphics/pieces/classic/bpawn.png"));
        } catch (Exception ex) {
            System.out.println("Error loading bpawn image");
        }

        try {
            wRookImage = ImageIO.read(new File("resource/chessgraphics/pieces/classic/wrook.png"));
        } catch (Exception ex) {
            System.out.println("Error loading wrook image");
        }

        try {
            bRookImage = ImageIO.read(new File("resource/chessgraphics/pieces/classic/brook.png"));
        } catch (Exception ex) {
            System.out.println("Error loading brook image");
        }

        try {
            wBishopImage = ImageIO.read(new File("resource/chessgraphics/pieces/classic/wbishop.png"));
        } catch (Exception ex) {
            System.out.println("Error loading wbishop image");
        }

        try {
            bBishopImage = ImageIO.read(new File("resource/chessgraphics/pieces/classic/bbishop.png"));
        } catch (Exception ex) {
            System.out.println("Error loading bbishop image");
        }

        try {
            wKnightImage = ImageIO.read(new File("resource/chessgraphics/pieces/classic/wknight.png"));
        } catch (Exception ex) {
            System.out.println("Error loading wknight image");
        }

        try {
            bKnightImage = ImageIO.read(new File("resource/chessgraphics/pieces/classic/bknight.png"));
        } catch (Exception ex) {
            System.out.println("Error loading bknight image");
        }

        try {
            wQueenImage = ImageIO.read(new File("resource/chessgraphics/pieces/classic/wqueen.png"));
        } catch (Exception ex) {
            System.out.println("Error loading wqueen image");
        }

        try {
            bQueenImage = ImageIO.read(new File("resource/chessgraphics/pieces/classic/bqueen.png"));
        } catch (Exception ex) {
            System.out.println("Error loading bqueen image");
        }

        try {
            wKingImage = ImageIO.read(new File("resource/chessgraphics/pieces/classic/wking.png"));
        } catch (Exception ex) {
            System.out.println("Error loading wking image");
        }

        try {
            bKingImage = ImageIO.read(new File("resource/chessgraphics/pieces/classic/bking.png"));
        } catch (Exception ex) {
            System.out.println("Error loading bking image");
        }

        try {
            currentImage = ImageIO.read(new File("resource/chessgraphics/graphics/currentsquare.png"));
        } catch (Exception ex) {
            System.out.println("Error loading move Highlight image");
        }

        try {
            mouseHighlightImage = ImageIO.read(new File("resource/chessgraphics/graphics/mousehighlight.png"));
        } catch (Exception ex) {
            System.out.println("Error loading move Highlight image");
        }

        try {
            highlightImage = ImageIO.read(new File("resource/chessgraphics/graphics/movehighlight.png"));
        } catch (Exception ex) {
            System.out.println("Error loading move Highlight image");
        }

        try {
            threatenedImage = ImageIO.read(new File("resource/chessgraphics/graphics/threatenedsquare.png"));
        } catch (Exception ex) {
            System.out.println("Error loading move Threatened image");
        }

        try {
            lastMoveImage = ImageIO.read(new File("resource/chessgraphics/graphics/lastmovesquare.png"));
        } catch (Exception ex) {
            System.out.println("Error loading Last Move image");
        }
    }

    /**
     * @return the boardImage
     */
    public static Image getBoardImage() {
        return boardImage;
    }

    /**
     * @return the deskImage
     */
    public static Image getBorderImage() {
        return borderImage;
    }

    /**
     * @return the statusPanelImage
     */
    public static Image getStatusPanelImage() {
        return statusPanelImage;
    }

    /**
     * @return the wPawnHighlightedImage
     */
    public static Image getwPawnHighlightedImage() {
        return wPawnHighlightedImage;
    }

    /**
     * @return the bPawnHighlightedImage
     */
    public static Image getbPawnHighlightedImage() {
        return bPawnHighlightedImage;
    }

    /**
     * @return the wPawnImage
     */
    public static Image getwPawnImage() {
        return wPawnImage;
    }

    /**
     * @return the bPawnImage
     */
    public static Image getbPawnImage() {
        return bPawnImage;
    }

    /**
     * @return the wRookImage
     */
    public static Image getwRookImage() {
        return wRookImage;
    }

    /**
     * @return the bRookImage
     */
    public static Image getbRookImage() {
        return bRookImage;
    }

    /**
     * @return the wKnightImage
     */
    public static Image getwKnightImage() {
        return wKnightImage;
    }

    /**
     * @return the bKnightImage
     */
    public static Image getbKnightImage() {
        return bKnightImage;
    }

    /**
     * @return the wBishopImage
     */
    public static Image getwBishopImage() {
        return wBishopImage;
    }

    /**
     * @return the bBishopImage
     */
    public static Image getbBishopImage() {
        return bBishopImage;
    }

    /**
     * @return the wKingImage
     */
    public static Image getwKingImage() {
        return wKingImage;
    }

    /**
     * @return the bKingImage
     */
    public static Image getbKingImage() {
        return bKingImage;
    }

    /**
     * @return the wQueenImage
     */
    public static Image getwQueenImage() {
        return wQueenImage;
    }

    /**
     * @return the bQueenImage
     */
    public static Image getbQueenImage() {
        return bQueenImage;
    }

    /**
     * @return the iconImage
     */
    public static Image getIconImage() {
        return iconImage;
    }

    /**
     * @return the deskImage
     */
    public static Image getDeskImage() {
        return deskImage;
    }

    /**
     * @return the logoImage
     */
    public static Image getLogoImage() {
        return logoImage;
    }

    /**
     * @return the pvcImage
     */
    public static Image getPvcImage() {
        return pvcImage;
    }

    /**
     * @return the pvpLocalImage
     */
    public static Image getPvpLocalImage() {
        return pvpLocalImage;
    }

    /**
     * @return the pvpInternetImage
     */
    public static Image getPvpInternetImage() {
        return pvpInternetImage;
    }

    /**
     * @return the titlePanelImage
     */
    public static Image getTitlePanelImage() {
        return titlePanelImage;
    }

    /**
     * @return the currentImage
     */
    public static Image getCurrentImage() {
        return currentImage;
    }

    /**
     * @return the highlightImage
     */
    public static Image getHighlightImage() {
        return highlightImage;
    }

    /**
     * @return the threatenedImage
     */
    public static Image getThreatenedImage() {
        return threatenedImage;
    }

    /**
     * @return the lastMoveImage
     */
    public static Image getLastMoveImage() {
        return lastMoveImage;
    }

    /**
     * @return the mouseHighlightImage
     */
    public static Image getMouseHighlightImage() {
        return mouseHighlightImage;
    }
}
